package tx.core.graphics;

import javax.swing.JComponent;
import javax.swing.RepaintManager;

/**
 * A RepaintManager that doesn't repaint anything.
 * 
 *  Based on NullRepaintManager by David Brackeen. 
 * @author Guilherme Mauro Germoglio Barbosa - germoglio@gmail.com
 */
public class NullRepaintManager extends RepaintManager {

	/**
	 * Installs the NullRepaintManager.
	 */
	public static void install() {
		RepaintManager nullRepaintManager = new NullRepaintManager();
		nullRepaintManager.setDoubleBufferingEnabled(false);
		RepaintManager.setCurrentManager(nullRepaintManager);
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.RepaintManager#addInvalidComponent(javax.swing.JComponent)
	 */
	public synchronized void addInvalidComponent(JComponent invalidComponent) {
		// do nothing.
	}

	/* (non-Javadoc)
	 * @see javax.swing.RepaintManager#addDirtyRegion(javax.swing.JComponent, int, int, int, int)
	 */
	public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
		// do nothing
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.RepaintManager#markCompletelyDirty(javax.swing.JComponent)
	 */
	public void markCompletelyDirty(JComponent aComponent) {
		// do nothing
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.RepaintManager#paintDirtyRegions()
	 */
	public void paintDirtyRegions() {
		// do nothing.
	}
	
}
